/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package libreriaTicket.dao;

import conexion.BD;
import conexion.SqlFormat;
import java.util.ArrayList;
import libreriaTicket.entity.Comuna;
import libreriaTicket.entity.Pais;

/**
 *
 * @author Duoc
 */
public class DaoPais {

    /*
     / * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    /**
     *
     * @author Duoc
     */
    public static boolean sqlInsert(Pais pais) {
        try {
            SqlFormat sql = new SqlFormat(SqlFormat.INSERTAR, "pais");
            sql.addField("id", pais.getCodigo());
            sql.addField("descripcion", pais.getDescripcion());


            return BD.getInstance().sqlEjecutar(sql.crearInstruccion());



        } catch (Exception e) {
        }
        return false;
    }

    public static boolean sqlUpdate(Pais pais) {
        try {

            SqlFormat sql = new SqlFormat(SqlFormat.INSERTAR, "pais");
            sql.where("codigo", pais.getCodigo());
            sql.addField("descripcion", pais.getDescripcion());

            return BD.getInstance().sqlEjecutar(sql.crearInstruccion());


        } catch (Exception e) {
        }
        return false;
    }

    public static boolean sqlDelete(Pais pais) {
        try {
            SqlFormat sql = new SqlFormat(SqlFormat.ELIMINAR, "pais");
            sql.where("codigo", pais.getCodigo());

            return BD.getInstance().sqlEjecutar(sql.crearInstruccion());


        } catch (Exception e) {
        }
        return false;
    }
}
